<%@page import="com.pay.juying.server.MD5"%>
<%@page import="com.jsp.payment.service.PaymentService"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="com.vo.Gateway"%>
<%@page import="java.math.BigDecimal"%>
<%@page import="org.dom4j.Document"%>
<%@page import="org.dom4j.DocumentHelper"%>
<%@page import="org.dom4j.Element"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
	String partner = request.getParameter("partner");
	String ordernumber = request.getParameter("ordernumber");
	String orderstatus = request.getParameter("orderstatus");
	String paymoney = request.getParameter("paymoney");
	String sysnumber = request.getParameter("sysnumber");
	String attach = request.getParameter("attach");
	String sign = request.getParameter("sign");
	Gateway gateway = Gateway.dao.findById(21);
	String MD5key = gateway.getStr("gateway_key");
	String md5Str = "partner=" + partner + "&ordernumber=" + ordernumber + "&orderstatus=" + orderstatus + "&paymoney=" + paymoney + MD5key;
	MD5 md5 = new MD5();
	String MD5info = md5.getMD5ofStr(md5Str).toLowerCase();
	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	if(MD5info.equals(sign)){
		if(orderstatus.equals("1")){
				PaymentService.service.netcallback("", ordernumber, "", sdf.format(new Date()), sdf.format(new Date()));
				response.sendRedirect(basePath+"/payment/showPayOk");
			} else {
				PaymentService.service.failure(ordernumber, sdf.format(new Date()));
				response.sendRedirect(basePath+"/payment/showPayNo");
			}
	} else {
		out.println("交易签名被篡改!");
	}
%>